package com.bw.live_streaming.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.bw.live_streaming.entity.ClinicalEntity;
import com.bw.live_streaming.service.ClinicalService;
import com.bw.common.utils.PageUtils;
import com.bw.common.utils.R;



/**
 * 
 *
 * @author wj
 * @email sunlightcs@gmail.com
 * @date 2021-08-22 21:43:42
 */
@RestController
@RequestMapping("live_streaming/clinical")
public class ClinicalController {
    @Autowired
    private ClinicalService clinicalService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = clinicalService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{clinicalId}")
    public R info(@PathVariable("clinicalId") Integer clinicalId){
		ClinicalEntity clinical = clinicalService.getById(clinicalId);

        return R.ok().put("clinical", clinical);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody ClinicalEntity clinical){
		clinicalService.save(clinical);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody ClinicalEntity clinical){
		clinicalService.updateById(clinical);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] clinicalIds){
		clinicalService.removeByIds(Arrays.asList(clinicalIds));

        return R.ok();
    }

}
